#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<assert.h>
#include<vector>

#include"vector.h"

using namespace std;

void test1()
{
	cx::vector<int> vv;
	vv.push_back(1);
	vv.push_back(2);
	vv.push_back(3);
	vv.push_back(4);
	vv.push_back(5);

	for (size_t i = 0; i < vv.size(); i++)
	{
		cout << vv[i] << endl;
	}
	cout << vv.capacity() << endl;
	cout << vv.size() << endl;

	vv.resize(100);
	vv.pop_back();
	cout << vv.capacity() << endl;
	cout << vv.size() << endl;

	vv.resize(0);
	cout << vv.capacity() << endl;
	cout << vv.size() << endl;

	cout << vv.empty() << endl;
}

void test2()
{
	cx::vector<int> vv;
	vv.push_back(1);
	vv.push_back(2);
	vv.push_back(4);
	vv.push_back(5);
	for (auto e : vv)
	{
		cout << e << ' ';
	}
	cout << endl;
	cx::vector<int> vv1(vv);

	for (auto e : vv1)
	{
		cout << e << ' ';
	}
	cout << endl;
	vv1.insert(vv1.begin(), 0);
	for (auto e : vv1)
	{
		cout << e << ' ';
	}
	cout << endl;
}


void test3()
{
	cx::vector<int> vv;
	vv.push_back(1);
	vv.push_back(2);
	vv.push_back(4);
	vv.push_back(5);
	for (auto e : vv)
	{
		cout << e << ' ';
	}
	cout << endl;
	cx::vector<int> vv1(vv);
	vv1.erase(vv1.begin()+2);
	for (auto e : vv1)
	{
		cout << e << ' ';
	}
	cout << endl;

	std::vector<int> v1 = { 1,2,3,4 };
	v1.erase(v1.begin(), v1.end() - 1);
	for (auto e : v1)
	{
		cout << e << ' ';
	}
	cout << endl;


}


void test4()
{
	cx::vector<int> vv;
	vv.push_back(1);
	vv.push_back(2);
	vv.push_back(4);
	vv.push_back(5);
	for (auto e : vv)
	{
		cout << e << ' ';
	}
	cout << endl;

	cx::vector<int> v1(vv.begin() + 1, vv.end() - 1);

	for (auto e : v1)
	{
		cout << e << ' ';
	}
	cout << endl;

	cx::vector<int> v2(5);
	for (auto e : v2)
	{
		cout << e << ' ';
	}
	cout << endl;

}

int main()
{
	//test1();
	//test2();
	//test3();
	test4();

	return 0;
}